library(dplyr)
library(lavaan)
library(DiagrammeR)
library(tidyr)
library(ggplot2)
combined=read.csv("data/annual_averages/annual_data_compiled_regions.csv",stringsAsFactors = F)
cnames=read.csv("analysis/column_names_region.csv", stringsAsFactors = F)
dsub=filter(combined, Year>=1975) %>% arrange(Region,Year)
focaldata=dsub[,cnames$Datacolumn]
fvars=cnames$Shortname
colnames(focaldata)=fvars
regions=unique(focaldata$region)
regionorder=c("West","North","South")
years=1975:2021
focaldata = focaldata %>%
mutate(tzoop=hcope+clad+mysid+pcope+rotif_m,
tzoop_e=hcope_e+clad_e+mysid_e+pcope_e+rotif_e,
hzoop=hcope+clad+rotif_m,
hzoop_e=hcope_e+clad_e+rotif_e,
pzoop=mysid+pcope,
pzoop_e=mysid_e+pcope_e)
fvars=c(fvars,"tzoop","tzoop_e",
"hzoop","hzoop_e",
"pzoop","pzoop_e")
cnames=rbind(cnames,data.frame(Longname=NA,Shortname=c("tzoop","tzoop_e",
"hzoop","hzoop_e",
"pzoop","pzoop_e"),
Diagramname=c("Total Zooplankton\nBiomass",
"Total Zooplankton\nEnergy",
"Herbivorous Zooplankton\nBiomass",
"Herbivorous Zooplankton\nEnergy",
"Predatory Zooplankton\nBiomass",
"Predatory Zooplankton\nEnergy"),
Datacolumn=NA,Log="yes"))
#focal variables
varnames=c("temp","flow","secchi","chla","hzoop","pzoop","tzoop","amphi","potam","corbic","estfish","estfish_bsmt","estfish_stn")
source("analysis/myLavaanPlot.r")
Log transform, scale
#log transform
logvars=fvars[cnames$Log=="yes"]
logtrans=function(x) {
x2=x[which(!is.na(x))]
if(any(x2==0)) {log(x+min(x2[which(x2>0)],na.rm=T))}
else {log(x)}
}
focaldatalog = focaldata %>%
mutate_at(logvars,logtrans)
#scale data
fdr0=focaldatalog
tvars=fvars[-(1:2)]
fdr=fdr0 %>% group_by(region) %>%
#lag
#mutate_at(tvars,list("1"=lag)) %>%
#scale
mutate_at(-(1:2),scale) %>%
ungroup() %>%
as.data.frame()
#detrended data
fdr_dtr=fdr0 %>% group_by(region) %>%
#detrend
mutate_at(tvars,function(x) {
x<<-x
if(!all(is.na(x))) {
if((length(which(x==0))/length(x))<0.5) {
x2<<-x
x2[x2==0]=NA
res<<-residuals(lm(x2~years))
out=x
out[which(!is.na(x2))]=res
return(out)
} else {return(x)}
} else {return(x)}
}) %>%
#lag
#mutate_at(tvars,list("1"=lag)) %>%
#scale
mutate_at(-(1:2),scale) %>%
ungroup() %>%
as.data.frame()
Breakdown of total zooplankton biomass.
## Warning: Removed 15 rows containing missing values (position_stack).
Similarity of fish indices.
## Warning: Removed 7 rows containing missing values (geom_path).
## Warning: Removed 7 rows containing missing values (geom_path).
Correlation between biomass and energy.
for(i in 1:length(regions)) {
dtemp=filter(fdr,region==regions[i])
print(regions[i])
print(cor(dtemp$tzoop,dtemp$tzoop_e,use = "p"))
print(cor(dtemp$hzoop,dtemp$hzoop_e,use = "p"))
print(cor(dtemp$pzoop,dtemp$pzoop_e,use = "p"))
}
## [1] "North"
## [1] 0.9989681
## [1] 0.9958644
## [1] 0.9990414
## [1] "South"
## [1] 0.9987488
## [1] 0.9977845
## [1] 0.9993711
## [1] "West"
## [1] 0.999451
## [1] 0.9986605
## [1] 0.9994171
(only sig correlations shown… no correction for multiple comparisons)
Note correlation of fish indices, or lack thereof.
With and without detrending.
West
#1
# modwest='zoop=~hcope+mysid
# fish=~estfish_bsmt+estfish_bsot
# zoop~chla+potam+flow
# chla~potam+flow
# fish~zoop+flow
# '
#2
# modwest='chla~potam+flow
# tzoop~chla+potam+flow
# estfish_bsmt~tzoop+flow
# estfish_bsot~tzoop+flow
# '
#3
# modwest='chla~potam+flow+temp+secchi
# tzoop~chla+potam+flow+temp+secchi
# amphi~chla+potam+flow+temp+secchi
# estfish_bsmt~tzoop+amphi+flow
# #estfish_bsot~tzoop+amphi+flow+temp+secchi
# amphi~~tzoop
# '
#4
# modwest='chla~potam+flow+temp+secchi
# hzoop~chla+potam+flow+temp+secchi
# pzoop~chla+potam+flow+temp+secchi+hzoop
# amphi~chla+potam+flow+temp+secchi
# estfish_bsmt~hzoop+pzoop+amphi+flow+temp+secchi
# amphi~~hzoop+pzoop
# '
#5
modwest='chla~potam+flow+temp+secchi
hzoop~chla+potam+flow+temp+secchi
pzoop~chla+potam+flow+temp+secchi+hzoop
fish~hzoop+pzoop+potam+flow+temp+secchi
fish=~estfish+estfish_stn+estfish_bsmt
'
modfitwest=sem(modwest, data=filter(fdr,region=="West"))
modfitwest_dtr=sem(modwest, data=filter(fdr_dtr,region=="West"))
summary(modfitwest, standardized=T, rsq=T)
## lavaan 0.6-4 ended normally after 39 iterations
##
## Optimization method NLMINB
## Number of free parameters 30
##
## Used Total
## Number of observations 40 47
##
## Estimator ML
## Model Fit Test Statistic 18.778
## Degrees of freedom 15
## P-value (Chi-square) 0.224
##
## Parameter Estimates:
##
## Information Expected
## Information saturated (h1) model Structured
## Standard Errors Standard
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## fish =~
## estfish 1.000 0.891 0.895
## estfish_stn 0.891 0.110 8.127 0.000 0.794 0.872
## estfish_bsmt 0.830 0.137 6.050 0.000 0.740 0.749
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## chla ~
## potam -0.361 0.148 -2.438 0.015 -0.361 -0.422
## flow 0.148 0.153 0.964 0.335 0.148 0.179
## temp 0.010 0.131 0.074 0.941 0.010 0.011
## secchi 0.126 0.196 0.640 0.522 0.126 0.124
## hzoop ~
## chla 0.603 0.105 5.733 0.000 0.603 0.593
## potam -0.211 0.105 -2.005 0.045 -0.211 -0.243
## flow 0.275 0.103 2.664 0.008 0.275 0.327
## temp 0.156 0.087 1.785 0.074 0.156 0.178
## secchi 0.261 0.131 1.987 0.047 0.261 0.254
## pzoop ~
## chla 0.453 0.100 4.550 0.000 0.453 0.443
## potam -0.002 0.078 -0.027 0.978 -0.002 -0.002
## flow -0.236 0.079 -3.001 0.003 -0.236 -0.279
## temp 0.090 0.064 1.421 0.155 0.090 0.103
## secchi -0.090 0.096 -0.934 0.350 -0.090 -0.087
## hzoop 0.582 0.111 5.247 0.000 0.582 0.579
## fish ~
## hzoop 0.132 0.158 0.835 0.403 0.149 0.129
## pzoop 0.342 0.142 2.398 0.016 0.384 0.334
## potam -0.317 0.087 -3.640 0.000 -0.356 -0.356
## flow 0.263 0.096 2.745 0.006 0.296 0.305
## temp 0.090 0.069 1.306 0.192 0.102 0.101
## secchi -0.230 0.108 -2.127 0.033 -0.258 -0.218
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .estfish 0.198 0.058 3.386 0.001 0.198 0.199
## .estfish_stn 0.199 0.054 3.664 0.000 0.199 0.240
## .estfish_bsmt 0.428 0.102 4.182 0.000 0.428 0.439
## .chla 0.578 0.129 4.472 0.000 0.578 0.793
## .hzoop 0.255 0.057 4.472 0.000 0.255 0.339
## .pzoop 0.126 0.028 4.472 0.000 0.126 0.165
## .fish 0.058 0.039 1.491 0.136 0.073 0.073
##
## R-Square:
## Estimate
## estfish 0.801
## estfish_stn 0.760
## estfish_bsmt 0.561
## chla 0.207
## hzoop 0.661
## pzoop 0.835
## fish 0.927
summary(modfitwest_dtr, standardized=T, rsq=T)
## lavaan 0.6-4 ended normally after 33 iterations
##
## Optimization method NLMINB
## Number of free parameters 30
##
## Used Total
## Number of observations 40 47
##
## Estimator ML
## Model Fit Test Statistic 15.635
## Degrees of freedom 15
## P-value (Chi-square) 0.407
##
## Parameter Estimates:
##
## Information Expected
## Information saturated (h1) model Structured
## Standard Errors Standard
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## fish =~
## estfish 1.000 0.679 0.737
## estfish_stn 1.108 0.228 4.852 0.000 0.753 0.765
## estfish_bsmt 0.932 0.232 4.022 0.000 0.633 0.641
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## chla ~
## potam 0.037 0.157 0.236 0.814 0.037 0.039
## flow 0.321 0.178 1.799 0.072 0.321 0.342
## temp -0.287 0.166 -1.736 0.083 -0.287 -0.298
## secchi 0.466 0.234 1.994 0.046 0.466 0.388
## hzoop ~
## chla 0.538 0.117 4.601 0.000 0.538 0.519
## potam -0.073 0.116 -0.627 0.531 -0.073 -0.074
## flow 0.465 0.137 3.389 0.001 0.465 0.478
## temp 0.034 0.127 0.269 0.788 0.034 0.034
## secchi 0.553 0.181 3.050 0.002 0.553 0.443
## pzoop ~
## chla 0.393 0.103 3.818 0.000 0.393 0.449
## potam 0.039 0.083 0.466 0.641 0.039 0.047
## flow -0.218 0.111 -1.970 0.049 -0.218 -0.266
## temp 0.091 0.090 1.001 0.317 0.091 0.107
## secchi -0.076 0.143 -0.528 0.597 -0.076 -0.072
## hzoop 0.459 0.113 4.075 0.000 0.459 0.544
## fish ~
## hzoop 0.030 0.122 0.244 0.807 0.044 0.044
## pzoop 0.301 0.130 2.318 0.020 0.443 0.373
## potam -0.165 0.079 -2.079 0.038 -0.243 -0.246
## flow 0.453 0.120 3.783 0.000 0.667 0.684
## temp -0.028 0.081 -0.340 0.734 -0.041 -0.040
## secchi -0.034 0.133 -0.260 0.795 -0.051 -0.040
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .estfish 0.389 0.101 3.861 0.000 0.389 0.458
## .estfish_stn 0.403 0.109 3.702 0.000 0.403 0.415
## .estfish_bsmt 0.574 0.138 4.163 0.000 0.574 0.589
## .chla 0.775 0.173 4.472 0.000 0.775 0.840
## .hzoop 0.424 0.095 4.472 0.000 0.424 0.427
## .pzoop 0.215 0.048 4.472 0.000 0.215 0.304
## .fish 0.042 0.048 0.871 0.384 0.091 0.091
##
## R-Square:
## Estimate
## estfish 0.542
## estfish_stn 0.585
## estfish_bsmt 0.411
## chla 0.160
## hzoop 0.573
## pzoop 0.696
## fish 0.909
labelswest <- createLabels(modfitwest, cnames)
# residuals(modfitwest)
# modificationindices(modfitwest)
North
#1
# modnorth='zoop=~hcope+mysid
# #fish=~estfish_bsmt+estfish_bsot
# zoop~chla+potam+flow
# chla~potam+flow
# estfish_bsmt~zoop+flow
# estfish_bsot~zoop+flow
# '
# modnorth='zoop=~clad
# zoop~chla+corbic+potam+flow
# chla~corbic+potam+flow
# estfish_bsmt~zoop+flow+sside+chla
# estfish_bsot~zoop+flow+sside+chla
# '
#2
# modnorth='chla~corbic+potam+flow
# tzoop~chla+corbic+potam+flow
# estfish_bsmt~tzoop+flow+chla
# estfish_bsot~tzoop+flow
# '
#3
# modnorth='chla~corbic+potam+flow+temp+secchi
# tzoop~chla+corbic+potam+flow+temp+secchi
# amphi~chla+corbic+potam+flow+temp+secchi
# estfish_bsmt~tzoop+amphi+flow+temp+secchi+chla+sside
# #estfish_bsot~tzoop+amphi+flow+temp+secchi+sside
# amphi~~tzoop
# '
#4
# modnorth='chla~corbic+flow+temp+secchi
# hzoop~chla+corbic+flow+temp+secchi
# pzoop~chla+corbic+flow+temp+secchi+hzoop
# amphi~chla+corbic+flow+temp+secchi
# estfish_bsmt~hzoop+pzoop+amphi+flow+temp+secchi+chla+sside
# amphi~~hzoop+pzoop
# '
#5
modnorth='chla~corbic+flow+temp+secchi
hzoop~chla+corbic+flow+temp+secchi
pzoop~chla+corbic+flow+temp+secchi+hzoop
fish~chla+hzoop+pzoop+corbic+flow+temp+secchi
fish=~estfish+estfish_stn #+estfish_bsmt
estfish_stn~~chla
'
modfitnorth=sem(modnorth, data=filter(fdr,region=="North"))
modfitnorth_dtr=sem(modnorth, data=filter(fdr_dtr,region=="North"))
summary(modfitnorth, standardized=T, rsq=T)
## lavaan 0.6-4 ended normally after 38 iterations
##
## Optimization method NLMINB
## Number of free parameters 30
##
## Used Total
## Number of observations 44 47
##
## Estimator ML
## Model Fit Test Statistic 5.580
## Degrees of freedom 5
## P-value (Chi-square) 0.349
##
## Parameter Estimates:
##
## Information Expected
## Information saturated (h1) model Structured
## Standard Errors Standard
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## fish =~
## estfish 1.000 0.805 0.805
## estfish_stn 1.038 0.196 5.300 0.000 0.836 0.864
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## chla ~
## corbic 0.295 0.116 2.540 0.011 0.295 0.307
## flow 0.168 0.133 1.258 0.208 0.168 0.174
## temp 0.267 0.128 2.098 0.036 0.267 0.276
## secchi -0.198 0.123 -1.607 0.108 -0.198 -0.198
## hzoop ~
## chla 0.311 0.120 2.595 0.009 0.311 0.307
## corbic 0.146 0.115 1.269 0.205 0.146 0.150
## flow 0.048 0.128 0.378 0.706 0.048 0.049
## temp 0.240 0.121 1.989 0.047 0.240 0.245
## secchi -0.412 0.111 -3.703 0.000 -0.412 -0.408
## pzoop ~
## chla 0.617 0.091 6.772 0.000 0.617 0.600
## corbic 0.387 0.083 4.670 0.000 0.387 0.392
## flow -0.342 0.090 -3.778 0.000 -0.342 -0.345
## temp 0.164 0.089 1.838 0.066 0.164 0.164
## secchi -0.136 0.090 -1.509 0.131 -0.136 -0.133
## hzoop -0.023 0.107 -0.219 0.826 -0.023 -0.023
## fish ~
## chla -0.517 0.179 -2.882 0.004 -0.642 -0.616
## hzoop 0.351 0.131 2.676 0.007 0.436 0.424
## pzoop 0.272 0.178 1.529 0.126 0.338 0.334
## corbic -0.191 0.132 -1.451 0.147 -0.238 -0.238
## flow 0.183 0.133 1.372 0.170 0.227 0.226
## temp 0.299 0.121 2.477 0.013 0.372 0.368
## secchi -0.335 0.119 -2.816 0.005 -0.416 -0.401
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .estfish_stn ~~
## .chla 0.393 0.128 3.071 0.002 0.393 0.742
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .estfish 0.351 0.099 3.547 0.000 0.351 0.351
## .estfish_stn 0.434 0.144 3.019 0.003 0.434 0.464
## .chla 0.645 0.138 4.690 0.000 0.645 0.700
## .hzoop 0.409 0.087 4.690 0.000 0.409 0.432
## .pzoop 0.205 0.044 4.690 0.000 0.205 0.210
## .fish 0.156 0.073 2.141 0.032 0.240 0.240
##
## R-Square:
## Estimate
## estfish 0.649
## estfish_stn 0.536
## chla 0.300
## hzoop 0.568
## pzoop 0.790
## fish 0.760
summary(modfitnorth_dtr, standardized=T, rsq=T)
## lavaan 0.6-4 ended normally after 37 iterations
##
## Optimization method NLMINB
## Number of free parameters 30
##
## Used Total
## Number of observations 44 47
##
## Estimator ML
## Model Fit Test Statistic 7.585
## Degrees of freedom 5
## P-value (Chi-square) 0.181
##
## Parameter Estimates:
##
## Information Expected
## Information saturated (h1) model Structured
## Standard Errors Standard
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## fish =~
## estfish 1.000 0.677 0.687
## estfish_stn 1.123 0.400 2.808 0.005 0.760 0.765
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## chla ~
## corbic 0.364 0.154 2.358 0.018 0.364 0.345
## flow 0.179 0.157 1.140 0.254 0.179 0.169
## temp 0.279 0.143 1.956 0.050 0.279 0.267
## secchi -0.175 0.133 -1.317 0.188 -0.175 -0.165
## hzoop ~
## chla 0.398 0.145 2.749 0.006 0.398 0.406
## corbic -0.066 0.172 -0.383 0.702 -0.066 -0.064
## flow 0.181 0.181 1.002 0.316 0.181 0.175
## temp 0.192 0.160 1.199 0.231 0.192 0.188
## secchi 0.004 0.156 0.026 0.979 0.004 0.004
## pzoop ~
## chla 0.662 0.095 6.935 0.000 0.662 0.661
## corbic 0.404 0.105 3.854 0.000 0.404 0.383
## flow -0.392 0.111 -3.516 0.000 -0.392 -0.371
## temp 0.171 0.099 1.721 0.085 0.171 0.163
## secchi -0.048 0.095 -0.502 0.615 -0.048 -0.045
## hzoop -0.069 0.092 -0.757 0.449 -0.069 -0.068
## fish ~
## chla -0.447 0.183 -2.444 0.015 -0.660 -0.694
## hzoop 0.095 0.105 0.911 0.362 0.141 0.145
## pzoop 0.203 0.174 1.171 0.242 0.300 0.316
## corbic -0.332 0.168 -1.982 0.048 -0.491 -0.489
## flow 0.265 0.159 1.661 0.097 0.391 0.389
## temp 0.311 0.133 2.332 0.020 0.459 0.461
## secchi -0.094 0.120 -0.786 0.432 -0.139 -0.138
##
## Covariances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .estfish_stn ~~
## .chla 0.633 0.219 2.884 0.004 0.633 0.749
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .estfish 0.513 0.153 3.363 0.001 0.513 0.528
## .estfish_stn 0.807 0.265 3.049 0.002 0.807 0.818
## .chla 0.884 0.189 4.690 0.000 0.884 0.801
## .hzoop 0.817 0.174 4.690 0.000 0.817 0.770
## .pzoop 0.302 0.064 4.690 0.000 0.302 0.273
## .fish 0.191 0.114 1.673 0.094 0.416 0.416
##
## R-Square:
## Estimate
## estfish 0.472
## estfish_stn 0.182
## chla 0.199
## hzoop 0.230
## pzoop 0.727
## fish 0.584
labelsnorth <- createLabels(modfitnorth, cnames)
# residuals(modfitnorth)
# modificationindices(modfitnorth)
South
#1
# modsouth='zoop=~hcope+mysid
# #fish=~estfish_bsmt+estfish_bsot
# zoop~chla+corbic+flow
# chla~corbic+flow
# estfish_bsmt~zoop+flow
# estfish_bsot~zoop+flow
# '
#2
# modsouth='chla~corbic+flow
# tzoop~chla+corbic+flow
# estfish_bsmt~tzoop+flow+corbic+sside
# estfish_bsot~tzoop+flow+corbic+sside
# '
#3
# modsouth='chla~corbic+flow+temp+secchi
# tzoop~chla+corbic+flow+temp+secchi
# amphi~chla+corbic+flow+temp+secchi
# estfish_bsmt~tzoop+amphi+flow+temp+secchi+corbic+sside
# #estfish_bsot~tzoop+amphi+flow+temp+secchi+corbic+sside
# amphi~~tzoop
# '
#4
# modsouth='chla~corbic+flow+temp+secchi
# hzoop~chla+corbic+flow+temp+secchi
# pzoop~chla+corbic+flow+temp+secchi+hzoop
# amphi~chla+corbic+flow+temp+secchi
# estfish_bsmt~hzoop+pzoop+amphi+flow+temp+secchi+corbic+sside
# amphi~~hzoop+pzoop
# '
#5
modsouth='chla~corbic+flow+temp+secchi
hzoop~chla+corbic+flow+temp+secchi
pzoop~chla+corbic+flow+temp+secchi+hzoop
fish~hzoop+pzoop+corbic+flow+temp+secchi
fish=~estfish+estfish_stn+estfish_bsmt
'
modfitsouth=sem(modsouth, data=filter(fdr,region=="South"))
modfitsouth_dtr=sem(modsouth, data=filter(fdr_dtr,region=="South"))
summary(modfitsouth, standardized=T, rsq=T)
## lavaan 0.6-4 ended normally after 28 iterations
##
## Optimization method NLMINB
## Number of free parameters 30
##
## Used Total
## Number of observations 40 47
##
## Estimator ML
## Model Fit Test Statistic 16.057
## Degrees of freedom 15
## P-value (Chi-square) 0.378
##
## Parameter Estimates:
##
## Information Expected
## Information saturated (h1) model Structured
## Standard Errors Standard
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## fish =~
## estfish 1.000 0.914 0.922
## estfish_stn 0.773 0.123 6.283 0.000 0.706 0.761
## estfish_bsmt 0.634 0.151 4.193 0.000 0.579 0.586
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## chla ~
## corbic 0.158 0.147 1.076 0.282 0.158 0.155
## flow 0.159 0.149 1.067 0.286 0.159 0.163
## temp 0.440 0.148 2.979 0.003 0.440 0.438
## secchi -0.318 0.152 -2.092 0.036 -0.318 -0.286
## hzoop ~
## chla 0.393 0.117 3.350 0.001 0.393 0.454
## corbic 0.277 0.111 2.505 0.012 0.277 0.313
## flow 0.037 0.112 0.327 0.744 0.037 0.043
## temp 0.179 0.121 1.482 0.138 0.179 0.206
## secchi 0.021 0.119 0.181 0.857 0.021 0.022
## pzoop ~
## chla 0.515 0.123 4.186 0.000 0.515 0.550
## corbic -0.053 0.110 -0.479 0.632 -0.053 -0.055
## flow 0.030 0.104 0.287 0.774 0.030 0.033
## temp 0.245 0.115 2.120 0.034 0.245 0.260
## secchi -0.127 0.110 -1.155 0.248 -0.127 -0.122
## hzoop 0.127 0.147 0.862 0.389 0.127 0.117
## fish ~
## hzoop 0.173 0.122 1.420 0.156 0.190 0.168
## pzoop -0.114 0.114 -0.997 0.319 -0.125 -0.119
## corbic 0.171 0.096 1.775 0.076 0.187 0.186
## flow -0.036 0.090 -0.399 0.690 -0.039 -0.041
## temp 0.090 0.106 0.848 0.396 0.098 0.099
## secchi -0.799 0.100 -7.962 0.000 -0.874 -0.803
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .estfish 0.148 0.066 2.226 0.026 0.148 0.151
## .estfish_stn 0.362 0.090 4.035 0.000 0.362 0.421
## .estfish_bsmt 0.640 0.148 4.311 0.000 0.640 0.656
## .chla 0.596 0.133 4.472 0.000 0.596 0.573
## .hzoop 0.328 0.073 4.472 0.000 0.328 0.421
## .pzoop 0.282 0.063 4.472 0.000 0.282 0.309
## .fish 0.102 0.062 1.643 0.100 0.122 0.122
##
## R-Square:
## Estimate
## estfish 0.849
## estfish_stn 0.579
## estfish_bsmt 0.344
## chla 0.427
## hzoop 0.579
## pzoop 0.691
## fish 0.878
summary(modfitsouth_dtr, standardized=T, rsq=T)
## lavaan 0.6-4 ended normally after 28 iterations
##
## Optimization method NLMINB
## Number of free parameters 30
##
## Used Total
## Number of observations 40 47
##
## Estimator ML
## Model Fit Test Statistic 14.251
## Degrees of freedom 15
## P-value (Chi-square) 0.507
##
## Parameter Estimates:
##
## Information Expected
## Information saturated (h1) model Structured
## Standard Errors Standard
##
## Latent Variables:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## fish =~
## estfish 1.000 0.821 0.897
## estfish_stn 0.297 0.254 1.172 0.241 0.244 0.233
## estfish_bsmt 0.353 0.256 1.376 0.169 0.290 0.293
##
## Regressions:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## chla ~
## corbic 0.064 0.158 0.408 0.683 0.064 0.063
## flow 0.208 0.175 1.189 0.234 0.208 0.213
## temp 0.450 0.173 2.599 0.009 0.450 0.447
## secchi 0.004 0.151 0.025 0.980 0.004 0.004
## hzoop ~
## chla 0.372 0.129 2.882 0.004 0.372 0.391
## corbic 0.267 0.129 2.062 0.039 0.267 0.276
## flow 0.034 0.146 0.232 0.816 0.034 0.036
## temp 0.186 0.153 1.220 0.222 0.186 0.195
## secchi 0.089 0.124 0.718 0.473 0.089 0.093
## pzoop ~
## chla 0.521 0.134 3.892 0.000 0.521 0.514
## corbic -0.133 0.128 -1.038 0.299 -0.133 -0.129
## flow 0.048 0.138 0.352 0.725 0.048 0.049
## temp 0.280 0.147 1.909 0.056 0.280 0.274
## secchi 0.077 0.117 0.653 0.514 0.077 0.075
## hzoop 0.125 0.149 0.836 0.403 0.125 0.117
## fish ~
## hzoop 0.151 0.150 1.003 0.316 0.184 0.178
## pzoop -0.274 0.140 -1.953 0.051 -0.334 -0.344
## corbic 0.145 0.135 1.071 0.284 0.177 0.177
## flow 0.027 0.143 0.192 0.848 0.033 0.035
## temp 0.193 0.159 1.212 0.226 0.235 0.238
## secchi -0.438 0.123 -3.573 0.000 -0.534 -0.542
##
## Variances:
## Estimate Std.Err z-value P(>|z|) Std.lv Std.all
## .estfish 0.163 0.357 0.457 0.647 0.163 0.195
## .estfish_stn 1.035 0.235 4.402 0.000 1.035 0.946
## .estfish_bsmt 0.891 0.205 4.337 0.000 0.891 0.914
## .chla 0.863 0.193 4.472 0.000 0.863 0.835
## .hzoop 0.576 0.129 4.472 0.000 0.576 0.616
## .pzoop 0.512 0.115 4.472 0.000 0.512 0.481
## .fish 0.398 0.366 1.086 0.278 0.590 0.590
##
## R-Square:
## Estimate
## estfish 0.805
## estfish_stn 0.054
## estfish_bsmt 0.086
## chla 0.165
## hzoop 0.384
## pzoop 0.519
## fish 0.410
labelssouth <- createLabels(modfitsouth, cnames)
# residuals(modfitsouth)
# modificationindices(modfitsouth)
West
North
South
West
North
South